unit stocktakestart;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, EditBtn, ButtonPanel, ExtCtrls, Buttons;

type

  { TStocktakeStartForm }

  TStocktakeStartForm = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    FileNameEdit1: TFileNameEdit;
    NewStocktakeOption: TRadioButton;
    ContinueStocktakeOption: TRadioButton;
    Panel1: TPanel;
    SaveDialog: TSaveDialog;
    procedure BitBtn1Click(Sender: TObject);
    procedure StocktakeOptionChange(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  StocktakeStartForm: TStocktakeStartForm;

implementation

{ TStocktakeStartForm }

procedure TStocktakeStartForm.StocktakeOptionChange(Sender: TObject);
begin
  FileNameEdit1.Enabled := ContinueStocktakeOption.Checked;
end;

procedure TStocktakeStartForm.BitBtn1Click(Sender: TObject);
begin
  if ContinueStocktakeOption.Checked then
     begin
       if FileExists(FileNameEdit1.Text)
          then ModalResult := mrOK
          else ShowMessage(FileNameEdit1.Text + ':'#10 + 'File not found!');
     end
     else if SaveDialog.Execute then
       begin
         FileNameEdit1.Text := SaveDialog.FileName;
         ModalResult := mrOk;
       end;
end;

initialization
  {$I stocktakestart.lrs}

end.

